import '@/assets/style/reset.css' // 初始化样式
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { useUserStore } from '@/stores/userStore';
import 'lib-flexible/flexible.js' // 修改根字体大小 // npm i lib-flexible 
import { Notify, Tabbar, TabbarItem, Form, Field, CellGroup, Button, Swipe, SwipeItem, Icon, Search } from 'vant';
// 2. 引入组件样式
import 'vant/lib/index.css';
// tailwindcss
import 'tailwindcss/tailwind.css';

import App from '@/App.vue'
import router from './router'

const app = createApp(App)

// 按需引入vant
app
    .use(Notify)
    .use(Tabbar)
    .use(TabbarItem)
    .use(Form)
    .use(Field)
    .use(CellGroup)
    .use(Button)
    .use(Swipe)
    .use(SwipeItem)
    .use(Icon)
    .use(Search)

app
    .use(router)
    .use(createPinia())






// 恢复状态
const userStore = useUserStore();
const userInfo = JSON.parse(localStorage.getItem('userInfo'));
const token = localStorage.getItem('token');

if (userInfo && token) {
    userStore.setUserInfo(userInfo);
    userStore.setToken(token);
}



// 挂载
app.mount('#app')
